'''获取断言信息'''
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
driver.maximize_window()

print('Before search===================')

# 打印当前页面title
title = driver.title
print(title)

# 打印当前页面URL
now_url = driver.current_url
print(now_url)

# 定位输入框元素，并输入“selenium”内容。
driver.find_element_by_id('kw').send_keys('selenium')
# 定位搜搜按钮，并点击元素
driver.find_element_by_id('su').click()
sleep(1)

print('After search===================')

# 打印当前页面title
title = driver.title
print(title)

# 打印当前页面URL
now_url = driver.current_url
print(now_url)

# 获取结果数
nums = driver.find_element_by_class_name('nums_text').text
print(nums)